﻿'
' Will Strohl (will.strohl@gmail.com)
' http://www.willstrohl.com
' http://dnntweet.codeplex.com
'
' Copyright (c) 2010, Will Strohl
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this 
' software and associated documentation files (the "Software"), to deal in the Software 
' without restriction, including without limitation the rights to use, copy, modify, 
' merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
' permit persons to whom the Software is furnished to do so, subject to the following 
' conditions:
'
' The above copyright notice and this permission notice shall be included in all copies 
' or substantial portions of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
' INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
' PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
' HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
' OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'

Imports DotNetNuke

Namespace WillStrohl.Modules.Twitter

    Public MustInherit Class DataProvider

#Region " Private Members "

        Private Const c_Object As String = "data"
        Private Const c_ObjectType As String = "WillStrohl.Modules.Twitter"

#End Region

#Region " Shared/Static Methods "

        ' singleton reference to the instantiated object 
        Private Shared objProvider As DataProvider = Nothing

        ' constructor
        Shared Sub New()
            CreateProvider()
        End Sub

        ' dynamically create provider
        Private Shared Sub CreateProvider()
            objProvider = CType(Framework.Reflection.CreateObject(c_Object, c_ObjectType, c_ObjectType), DataProvider)
        End Sub

        ' return the provider
        Public Shared Shadows Function Instance() As DataProvider
            Return objProvider
        End Function

#End Region

#Region " Abstract Methods "

        Public MustOverride Function AddSearchHistory(ByVal ModuleId As Integer, ByVal UserId As Integer, ByVal SearchText As String) As Integer
        Public MustOverride Sub UpdateSearchHistory(ByVal SearchId As Integer, ByVal ModuleId As Integer, ByVal UserId As Integer, ByVal SearchText As String)
        Public MustOverride Function DoesSearchHistoryExist(ByVal UserId As Integer, ByVal SearchText As String) As Boolean
        Public MustOverride Sub DeleteSearchHistory(ByVal SearchId As Integer)
        Public MustOverride Function GetSearchHistoryByUserId(ByVal UserId As Integer) As IDataReader
        Public MustOverride Function GetSearchHistoryByModuleId(ByVal ModuleId As Integer) As IDataReader
        Public MustOverride Function GetSearchHistoryBySearchId(ByVal SearchId As Integer) As IDataReader
        Public MustOverride Function GetSearchHistory() As IDataReader
        Public MustOverride Function GetSearchHistoryByModuleIdLike(ByVal ModuleId As Integer, ByVal SearchText As String) As IDataReader

#End Region

    End Class

End Namespace